package com.kun.portal.webframe.controller;

import com.kun.portal.webframe.po.AppointmentPo;
import com.kun.portal.webframe.po.FwUserPo;
import com.kun.portal.webframe.po.RoomPo;
import com.kun.portal.webframe.service.AppointmentService;
import com.kun.portal.webframe.service.RoomService;
import com.kun.portal.webframe.util.UserSessionUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;
import java.util.Date;
import java.util.List;

/**
 * Created by Administrator on 2018/5/4.
 */
@Controller
@RequestMapping({"/api/room"})
public class RoomController {
    private static final Logger LOG = LoggerFactory.getLogger(FwUserController.class);
    @Autowired
    private RoomService roomService;
    @RequestMapping(
            value = {"/saveRoom"},
            method = {RequestMethod.POST},
            produces = {"application/json"}
    )
    @ResponseBody
    public RoomPo addAppointment(@RequestBody RoomPo room, HttpSession session) {
        return roomService.saveRoom(room);
    }
    @RequestMapping(
            value = {"/deleteRoom"},
            method = {RequestMethod.POST},
            produces = {"application/json"}
    )
    @ResponseBody
    public void deleteAppointment(@RequestBody RoomPo room, HttpSession session) {
         roomService.deleteRoom(room);
    }
       @RequestMapping(
            value = {"/queryRoom"},
            method = {RequestMethod.GET},
            produces = {"application/json"}
    )
    @ResponseBody
    public List<RoomPo> queryAppointment(@RequestParam(required = false) String  filter, HttpSession session) {
        return roomService.getAllRooms(filter);
    }

}
